check given triangle is valid or not in C